﻿using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using IDAL;
using Model;

namespace DAL
{
    public class TAssembleStepItem : BaseRepository<TAssembleStepItemInfo>, ITAssembleStepItem
    {
        private const string PARM_ASSEMBLESTEPITEM_PRODUCTSN = "@ProductSN";

        public IList<TAssembleStepItemInfo> GetTAssembleStepItembySN(string productSN)
        {
            SqlParameter parm = GetParameter();
            //Bind the parameter
            parm.Value = productSN;
            return ExcuteSqlToGetEntities("TAssembleStepItem_selectbySN", parm);
        }


        //-------------------------------------重写超类基础操作---------------------------------------------------------

        public override TAssembleStepItemInfo GetEntityRecord(SqlDataReader rdr)
        {
            TAssembleStepItemInfo pro = new TAssembleStepItemInfo(rdr.GetValue(0).ToString(), rdr.GetDateTime(1), rdr.GetValue(2).ToString(), rdr.GetValue(3).ToString());
            return pro;
        }

        public override SqlParameter GetParameter()
        {
            SqlParameter Parm = new SqlParameter(PARM_ASSEMBLESTEPITEM_PRODUCTSN, SqlDbType.NVarChar, 50);
            return Parm;
        }
    }
}
